#ifndef OPERATION_H
#define OPERATION_H

#include <QFile>
// 默认配置文件路径
const QString FilePath = "./config.json";

typedef struct FileConfig {
    QString ip;
    QString port;
    QString username;
    QString password;
    QString filepath;
    bool    is_save_pwd;
}fileConfig;
// 判断目录是否存在
bool isFile(const QString file=FilePath);

// 饿汉模式单例
class FileOperation
{
public:
    void writeConfig(fileConfig config);
    bool readConif(fileConfig* config);

    static FileOperation* getInstance()
    {
        return pSingleton;
    }
private:
    static FileOperation *pSingleton;
    FileOperation(){}
    ~FileOperation(){}
    FileOperation(FileOperation&){}
};

#endif // OPERATION_H
